import request from '@/utils/request'

// 查询服务项列表
export function listServiceItem(query) {
  return request({
    url: '/business/serviceItem/list',
    method: 'get',
    params: query
  })
}

// 查询服务项列表（不分页）  getServiceItemList
export function getServiceItemList(query) {
  return request({
    url: '/business/serviceItem/list',
    method: 'get',
    params: query,
    headers:{"cmd":"noPageList"}
  })
}

// 查询服务项详细
export function getServiceItem(id) {
  return request({
    url: '/business/serviceItem/' + id,
    method: 'get'
  })
}

// 新增服务项
export function addServiceItem(data) {
  return request({
    url: '/business/serviceItem',
    method: 'post',
    data: data
  })
}

// 修改服务项
export function updateServiceItem(data) {
  return request({
    url: '/business/serviceItem',
    method: 'put',
    data: data
  })
}

// 删除服务项
export function delServiceItem(id) {
  return request({
    url: '/business/serviceItem/' + id,
    method: 'delete'
  })
}

// 上架功能
export function saleOnHandle(id) {
  return request({
    url: '/business/serviceItem/' + id,
    method: 'patch',
    headers:{'cmd':'saleOn'}
  })
}

// 下架功能
export function saleOffHandle(id) {
  return request({
    url: '/business/serviceItem/' + id,
    method: 'patch',
    headers:{'cmd':'saleOff'}
  })
}

// 准备发起审批的信息 auditInfo 
export function getAuditInfoHandle(id) {
  return request({
    url: '/business/serviceItem/' + id + "/auditInfo",
    method: 'get',
  })
}

// 发起审批 startAudit
export function startAudit(data) {
  return request({
    url: '/business/serviceItem/audit',
    method: 'post',
    data:data
  })
}
